package thread.synchronize.dirtyread;

/**
 * @author cuihao
 * @date 2018/3/4
 */
public class Test {
    public static void main(String[] args) {
        try {
            PublicVar publicVar = new PublicVar();
            MyThread thread = new MyThread(publicVar);
            thread.start();
            Thread.sleep(500); // 打印结果受此值影响，大于线程threadA（即setValue方法）休眠的时间就不会出现脏读
            publicVar.getValue();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
